package com.javakc.mes.basis.section.controller;

import com.javakc.mes.basis.roadway.controller.RoadwayController;
import com.javakc.mes.basis.roadway.entity.Roadway;
import com.javakc.mes.basis.section.entity.Section;
import com.javakc.mes.basis.section.service.SectionService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

@RequestMapping("/mes/section")
@Api(tags = "生产执行工作面模块")
@RestController
public class SectionController {
    @Autowired
    private SectionService sectionService;
    @Autowired
    private RoadwayController roadwayController;

    @GetMapping
    @ApiOperation("查询所用工作面信息区域")
    public  List<Section> queryAll(){
        return sectionService.queryAll();
    }

    @PostMapping("insert")
    @ApiOperation("工作面新增区域")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "sectionName",value = "工作面名字",required = true),
            @ApiImplicitParam(name = "sectionStatus",value = "工作面状态",required = true),
            @ApiImplicitParam(name = "sectionPickType",value = "回采方式",required = true),
            @ApiImplicitParam(name = "sectionDropType",value = "落煤方式",required = true),
            @ApiImplicitParam(name = "sectionPickHigh",value = "采高",required = true),
            @ApiImplicitParam(name = "sectionPickLong",value = "采长",required = true),
            @ApiImplicitParam(name = "sectionTowardsLong",value = "走向长",required = true),
            @ApiImplicitParam(name = "sectionCoalThick",value = "煤厚",required = true),
            @ApiImplicitParam(name = "sectionCoalCapacity",value = "容量",required = true),
            @ApiImplicitParam(name = "sectionReserves",value = "计算储量",required = true),
            @ApiImplicitParam(name = "sectionRemark",value = "备注",required = true),
            @ApiImplicitParam(name = "areaId",value = "巷道外键",required = true),
    })
    public void insert(@RequestBody @Valid Section section){
        sectionService.insert(section);
    }
    @PostMapping("update")
    @ApiOperation("工作面修改区域")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "sectionName",value = "工作面名字",required = true),
            @ApiImplicitParam(name = "sectionStatus",value = "工作面状态",required = true),
            @ApiImplicitParam(name = "sectionPickType",value = "回采方式",required = true),
            @ApiImplicitParam(name = "sectionDropType",value = "落煤方式",required = true),
            @ApiImplicitParam(name = "sectionPickHigh",value = "采高",required = true),
            @ApiImplicitParam(name = "sectionPickLong",value = "采长",required = true),
            @ApiImplicitParam(name = "sectionTowardsLong",value = "走向长",required = true),
            @ApiImplicitParam(name = "sectionCoalThick",value = "煤厚",required = true),
            @ApiImplicitParam(name = "sectionCoalCapacity",value = "容量",required = true),
            @ApiImplicitParam(name = "sectionReserves",value = "计算储量",required = true),
            @ApiImplicitParam(name = "sectionRemark",value = "备注",required = true),
            @ApiImplicitParam(name = "areaId",value = "巷道外键",required = true),
    })
    public void update(@RequestBody Section section){

    }
    @ApiOperation("工作面查询一条数据区域")
    @GetMapping("{id}")
    @ApiImplicitParam(name = "id",value = "主键id",required = true)
    public Section findById(
            @ApiParam(name = "id",value = "主键id",required = true)
            @PathVariable int id){
        return sectionService.getById(id);
    }
    @DeleteMapping("{id}")
    @ApiOperation("工作面修改区域")
    @ApiImplicitParam(name = "id",value = "主键id",required = true)
    public void delete(@PathVariable int id){
        sectionService.removeById(id);
    }
}
